<template>
  <el-dialog :title="title"
             width="600px"
             :close-on-click-modal="false"
             @close="$emit('close')" :visible.sync="visible">
    <el-form :model="form" size="mini" ref="form">
        <el-form-item label="备注" label-width="80px">
          <el-input type="textarea" v-model="form.remark" :autosize="{ minRows: 4, maxRows: 8}" class="w450"/>
        </el-form-item>
    </el-form>
    <div slot="footer" class="center-box">
      <el-button @click="visible = false">取 消</el-button>
      <easy-button type="primary" @click="onOk">确定</easy-button>
    </div>
  </el-dialog>
</template>

<script>

export default {
  name: 'CancelPnrDialog',
  props: {
    data: {
      type: Object,
      default () {
        return {
          title: '取消PNR',
          localOrderId: '',
          pnr: ''
        }
      }
    }
  },
  data () {
    return {
      title: this.data.title,
      visible: true,
      form: {
        localOrderId: this.data.localOrderId,
        pnr: this.data.pnr,
        remark: null
      }
    }
  },
  created () {
  },
  methods: {
    onOk (done) {
      this.$service.order.cancelPnrCheckIssued(this.form).then(() => {
        this.$emit('ok')
        this.visible = false
      }).finally(done)
    }
  }
}
</script>

<style scoped>
.pnr-panel {
  padding: 10px;
  border: 1px solid #aee7fb;
}

.pnr-col {
  display: inline-block;
  box-sizing: border-box;
  padding: 0 10px;
}
</style>
